<script setup lang="tsx">
	import {
		h,
		onMounted,
		reactive,
		ref,
		toRaw
	} from "vue";
	import ReCol from "@/components/ReCol";
	import type {
		PaginationProps
	} from "@pureadmin/table";
	const prop = defineProps({
		info: {
			default: () => {}
		}
	});

	const orderProductsColumns: TableColumnList = [{
			label: "物料编号",
			prop: "material.code"
		},
		{
			label: "物料名称",
			prop: "material.name"
		},
		{
			label: "所属仓库",
			prop: "warehouse.name",
			formatter: (row: any) => {
				return row.warehouse?.name+'/'+row.warehouseArea?.name+'/'+row.warehouseLocation?.name
			}
		},
		{
			label: "账面库存",
			prop: "number"
		},
		{
			label: "实际库存",
			prop: "realNumber"
		},
		{
			label: "变化量",
			prop: "realNumber",
			formatter: (row: any) => {
				return row.realNumber - row.number
			}
		},
		{
			label: "说明",
			prop: "remarks"
		}
	];
</script>

<template>
	<div>
		<el-row :gutter="30">
			<re-col :value="6" :xs="24" :sm="24">
				<div>盘点单号：{{prop.info?.checkNo}}</div>
			</re-col>
			<re-col :value="6" :xs="24" :sm="24">
				<div>盈亏数：{{prop.info?.totalNum}}</div>
			</re-col>
			<re-col :value="5" :xs="24" :sm="24">
				<div>盘点类型：{{prop.info?.checkType === 1?'物料盘点':'仓库盘点'}}</div>
			</re-col>
			<re-col :value="7" :xs="24" :sm="24">
				<div>
					盘点仓库：
					{{prop.info?.checkProducts[0].warehouse.name}}/
					{{prop.info?.checkProducts[0].warehouseArea.name}}/
					{{prop.info?.checkProducts[0].warehouseLocation.name}}
				</div>
			</re-col>
		</el-row>
		<div style="margin-bottom: 10px;"></div>
		<pure-table ref="tableRef" align-whole="center" showOverflowTooltip  size="large" adaptive
			:adaptiveConfig="{ offsetBottom: 108 }" :data="prop.info?.checkProducts" :columns="orderProductsColumns"
			:paginationSmall="false" :header-cell-style="{
			background: 'var(--el-fill-color-light)',color: 'var(--el-text-color-primary)'}"
			style="height: auto;"
			>
		</pure-table>
		<p style="display: flex;align-items: center;justify-content: flex-end;margin-top: 20px;">
			当前入库单数据共： <el-tag>{{prop.info?.checkProducts.length}}</el-tag>&nbsp;&nbsp;条 </p>
	</div>
</template>
<style scoped></style>